<?php

class user extends page{
	
	function getUser(){
		$userInfo = $this->getUserInfo();
		$json = array();
		if(!$userInfo){
			$json['status'] = $this->f_status;
			$json['message'] = 'missing device_id';
			G::toClient($json);
        	}
		$json['host'] = HOST_IP_ARRAY;
        	$json['status'] = $this->s_status;
		$json['info'] = $userInfo;
		G::toClient($json);
	}
	
	function findByDeviceID($device_id){
		if(!$device_id){		
			return false;
		}
		
		$sql = "select t2.uid, t2.gold, t2.book_count, t2.phone, t2.email, t2.qq from account t1 left join user t2 on t1.uid=t2.uid where t1.device_id = '{$device_id}' limit 1";
		$rs = $this->db->query($sql)->fetch();
		if(!$rs){
			return false;
		}
		return $rs;
	}
}
